'use strict';
const uniPush = uniCloud.getPushManager({appId:"__UNI__3BB8154"})
exports.main = async (event, context) => {
	//event为客户端上传的参数
	let body = event.body;
	if (event.isBase64Encoded) {
		body = Buffer.from(body);
	}
	if(!body) {
		return { message: 'no body'};
	}
	const param = JSON.parse(body);
	//返回数据给客户
	console.log('param',param)
	const res = await uniPush.sendMessage({
		"push_clientid": param.cids,
		"title": param.title,
		"content": param.content,
		"payload": param.payload,
		"force_notification": param.notify,
		"request_id": param.request_id
	})
	return res
}
